window.onload = function () {
    var students = [ {
        fname: 'Ivan',
        lname: 'Ivanov',
        grade: 6
    }, {
        fname: 'Petar',
        lname: 'Petroff',
        grade: 6
    } ];

    $('main').append('<table></table>');
    $('main table').addClass('table')
        .append('<thead><tr><th>First name</th><th>Last name</th><th>Grade</th></tr></thead><tbody></tbody>');

    for (var i = 0; i < students.length; i++)
    {
        $('.table tbody')
            .append(
                '<tr>' +
                '<td>' + students[i].fname + '</td>' +
                '<td>' + students[i].lname + '</td>' +
                '<td>' + students[i].grade + '</td>' +
                '</tr>');
    }
};